#ifndef __DRV_UART_H__
#define __DRV_UART_H__


#define USING_UART1             (1)
#define USING_UART2             (1)
#define USING_UART3             (0)
#define USING_UART4             (0)
#define FIFO_BUF_SIZE           64

#define UART1_HALF_DUPLEX       (0)
#define UART2_HALF_DUPLEX       (0)
#define UART3_HALF_DUPLEX       (0)
#define UART4_HALF_DUPLEX       (0)

#define UART1_BAUDRATE          115200
#define UART2_BAUDRATE          115200
#define UART3_BAUDRATE          115200
#define UART4_BAUDRATE          115200


#if USING_UART1 != 0
extern uint16_t uart1_read_fifo(uint8_t *data, uint16_t num, uint16_t outtime_ms);
extern uint16_t uart1_write_fifo(uint8_t *data, uint16_t num, uint16_t outtime_ms);
extern void uart1_clear_rcv_fifo(void);
extern void UART1_RxFull_IrqCallback(void);
#endif

#if USING_UART2 != 0
extern uint16_t uart2_read_fifo(uint8_t *data, uint16_t num, uint16_t outtime_ms);
extern uint16_t uart2_write_fifo(uint8_t *data, uint16_t num, uint16_t outtime_ms);
extern void uart2_clear_rcv_fifo(void);
extern void UART2_RxFull_IrqCallback(void);
#endif

#if USING_UART3 != 0
extern uint16_t uart3_read_fifo(uint8_t *data, uint16_t num, uint16_t outtime_ms);
extern uint16_t uart3_write_fifo(uint8_t *data, uint16_t num, uint16_t outtime_ms);
extern void uart3_clear_rcv_fifo(void);
#endif

//extern struct rt_mutex mutex_dma1;
//extern struct rt_mutex mutex_dma2;

extern UART_HandleTypeDef huart1;

extern DMA_HandleTypeDef hdma_usart2_tx;
extern DMA_HandleTypeDef hdma_usart2_rx;
extern UART_HandleTypeDef huart2;

extern void uart_all_config(void);
#endif
